package com.ql.design.proxy.dynamic;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class DynamicProxy  implements InvocationHandler{
	private Object proxyed;
	
	
	//被代理的对象
	public DynamicProxy(Object obj){
		this.proxyed= obj;
		
	}
	
	public Object invoke(Object proxy,Method method  ,Object[] args) throws  Throwable{
		Object result;
		
		// 方法调用前;
		System.out.println("start  invoke!...");
		
		result = method.invoke(this.proxyed, args);
		// 方法调用后;
		System.out.println("end  invoke!...");
		
		return result;
	}
	
}
